<template>
    <div class="center">
        <div class="header">
            <div class="left">
                <image class="avatar" src="https://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png" />
                <div class="detail">
                    <div class="name">用户155527814325</div>
                    <div class="name1">普通用户</div>
                </div>
            </div>
            <div class="right">
                <div class="code">
                    <image
                        src="https://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png"
                        mode="scaleToFill" />
                </div>
                <div class="vip">
                    <image
                        src="https://img0.baidu.com/it/u=2409571969,828089373&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500"
                        mode="scaleToFill" />
                    <div class="pro">
                        Pro会员
                        <br />
                        立即开通
                        <image
                            src="https://img0.baidu.com/it/u=2409571969,828089373&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500"
                            mode="scaleToFill" />
                    </div>
                </div>
            </div>
        </div>

        <div class="zc">
            <h2>我的资产</h2>
            <div class="line"></div>
            <ul class="ul">
                <li class="li">
                    <span class="span">￥{{ 0 }}</span>
                    <p>余额</p>
                </li>
                <li class="li">
                    <span class="span">0</span>
                    <p>红包</p>
                </li>
                <li class="li">
                    <span class="span">0</span>
                    <p>优惠券</p>
                </li>
                <li class="li">
                    <span class="span">0</span>
                    <p>积分</p>
                </li>
                <li class="li">
                    <span class="span">0</span>
                    <p>礼品卡</p>
                </li>
            </ul>
        </div>

        <div class="content">
            <div class="item" :class="{ item1: (index + 1) % 3 == 0 }" v-for="(item, index) in 14" :key="index">
                <image
                    class="contentimg"
                    src="https://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png"
                    mode="widthFix" />
                <div class="name">我的订单</div>
            </div>
        </div>

        <div class="footer">退出登录</div>
    </div>
</template>

<script lang="ts" setup>
import { onMounted } from 'vue';
onMounted(() => {
    getUserInfo();
});
const getUserInfo = () => {
    const token = uni.getStorageSync('TOKEN');
    if (!token) {
        uni.navigateTo({
            url: '/pages/login/index',
        });
    }
};
</script>

<style lang="less" scoped>
.center {
    background-color: #eee;

    .header {
        width: 100%;
        height: 270rpx;
        background: url('	https://yanxuan.nosdn.127.net/5905098f74e04c39fa5e76ebb9ff591b.png') no-repeat;
        background-size: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-left: 30rpx;
        box-sizing: border-box;

        .left {
            display: flex;
            align-items: center;

            .avatar {
                width: 142rpx;
                height: 142rpx;
                border-radius: 50%;
            }

            .detail {
                color: #fff;
                margin-left: 20rpx;

                .name {
                    font-size: 36rpx;
                }

                .name1 {
                    font-size: 28rpx;
                }
            }
        }

        .right {
            display: flex;
            flex-direction: column;
            align-items: flex-end;

            .code {
                width: 64rpx;
                height: 64rpx;
                border: 1px solid black;
                margin-right: 16rpx;
                margin-bottom: 30rpx;

                image {
                    width: 100%;
                    height: 100%;
                }
            }

            .vip {
                width: 222rpx;
                height: 84rpx;
                background-color: #0e0e0e;
                display: flex;
                align-items: center;
                justify-content: space-around;
                border-radius: 40rpx 0 0 40rpx;

                image {
                    width: 56rpx;
                    height: 56rpx;
                    border-radius: 50%;
                }

                .pro {
                    font-size: 24rpx;
                    color: #f9e0c0;

                    image {
                        width: 18rpx;
                        height: 18rpx;
                    }
                }
            }
        }
    }

    .zc {
        width: 100%;
        margin-bottom: 20rpx;
        background-color: #fff;
        padding: 30rpx;
        box-sizing: border-box;
        margin-bottom: 20rpx;

        h2 {
            display: block;
            width: 100%;
            font-size: 28rpx;
        }
        .line {
            margin-top: 30rpx;
            width: 720rpx;
            height: 2rpx;
            background-color: #d9d9d9;
            text-align: right;
        }
        .ul {
            width: 100%;
            display: flex;

            .li {
                width: 20%;
                height: 160rpx;
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                .span {
                    font-weight: 800;
                }
                :first-child {
                    padding-bottom: 10rpx;
                    font-size: 32rpx;
                    color: #333;
                }
                :nth-child(2) {
                    font-size: 24rpx;
                    color: #333;
                }
            }
        }
    }

    .content {
        display: flex;
        flex-wrap: wrap;
        background-color: #fff;
        margin-bottom: 40rpx;
        .contentimg {
            width: 56rpx;
            height: 56rpx;
        }

        .item1 {
            border-right: none !important;
        }
        .item {
            width: 33.3%;
            height: 180rpx;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            border-right: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
            box-sizing: border-box;

            image {
                width: 50rpx;
                height: 50rpx;
                padding-bottom: 16rpx;
                box-sizing: border-box;
            }
            .name {
                font-size: 24rpx;
                color: #333;
            }
        }
    }

    .footer {
        width: 100%;
        height: 96pex;
        line-height: 96rpx;
        text-align: center;
        font-size: 28rpx;
        color: #333;
        background-color: #fff;
        margin: 20rpx 0rpx;
    }
}
</style>
